package com.iss.lxhproject.dao;

import com.iss.lxhproject.entity.Guest;
import com.iss.lxhproject.entity.Room;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface GuestDao {
    @Insert("insert into guest values (null,#{guest_name},#{guest_idcard},#{guest_phone},#{guest_roomid})")
    Integer insertGuest(Guest guest);

    @Insert("insert into guest values (null,#{guest_name},#{guest_idcard},#{guest_phone},#{guest_roomid})")
    Integer insertGuestforGuestlist(Guest guest);
    @Select("select guest_id,guest_name,guest_idcard,guest_phone,guest_roomid from guest")
    List<Guest> selectAllGuest();
    @Delete(" <script>"+"delete from guest where guest_id in" +
            "    <foreach collection=\"array\" item=\"guest_id\" separator=\",\" open=\"(\" close=\")\">" +
            "        #{guest_id}" +
            "    </foreach></script>")
    Integer deletGuest(Integer[] guest_id);
    @Update("update guest set guest_name=#{guest_name},guest_idcard=#{guest_idcard},guest_phone=#{guest_phone} where guest_id=#{guest_id}")
    Integer updateGuest(Guest guest);
    @Select("select * from guest where guest_id=#{guest_id}")
    Guest selectGuestById(Integer guest_id);


}
